﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SAP_dll
{

    public class SAP400
    {
            sap400.service s = new sap400.service();
            sap400.ZWS_GET_EQUI_TIVResponse r;
            sap400.ZWS_GET_EQUI_TIV p = new sap400.ZWS_GET_EQUI_TIV();

            public string getSerial(string procesna)
            {
                try
                {
                    p.LF_IN_ZSRTIV = procesna;
                    s.Credentials = new System.Net.NetworkCredential("web", "prenos");
                    r = s.ZWS_GET_EQUI_TIV(p);
                    if (r.RETURN.TYPE != "S")
                        throw new System.Exception(r.RETURN.MESSAGE);
                    return r.LF_OUT_SERGE;
                }
                catch (Exception e)
                {
                    throw new System.Exception(e.Message);
                }
            }

            public string getProcess(string serijska)
            {
                try
                {
                    p.LF_IN_SERGE = serijska;
                    s.Credentials = new System.Net.NetworkCredential("web", "prenos");
                    r = s.ZWS_GET_EQUI_TIV(p);
                    if (r.RETURN.TYPE != "S")
                        throw new System.Exception(r.RETURN.MESSAGE);
                    return r.LF_OUT_ZSRTIV;
                }
                catch (Exception e)
                {
                    throw new System.Exception(e.Message);
                }
            }
    }

}
